package model

import (
	layModel "zsc-boot/app/system_layer/model"
	"zsc-boot/core/orm"
)

type Order struct {
	orm.Model
	SignDate     string                           `json:"signDate" gorm:"column:sign_date;size:128;comment:签约时间"`
	CustomerId   uint                             `json:"customerId" gorm:"column:customer_id;size:32"`
	CustomerInfo *CustomerSimple                  `json:"customerInfo" gorm:"foreignKey:CustomerId"`
	ChannelId    uint                             `json:"channelId" gorm:"column:channel_id;size:32"`
	UserId       uint                             `json:"userId" form:"userId" gorm:"column:user_id;size:32"`
	UserInfo     layModel.ServiceUserSimple       `json:"userInfo" gorm:"foreignKey:UserId"`
	DepId        uint                             `json:"depId" form:"depId" gorm:"column:dep_id;comment:部门ID"`
	DepInfo      layModel.ServiceDepartmentSimple `json:"depInfo" gorm:"foreignKey:DepId"`
	Money        uint                             `json:"money" gorm:"column:money;comment:合同金额"`
	NotMoney     int                              `json:"notMoney" gorm:"-"`
	PaidInMoney  uint                             `json:"paidInMoney" gorm:"column:paid_in_money;comment:实缴金额"`
	Remark       string                           `json:"remark" gorm:"column:remark;type:text"`
	OrderAdds    []OrderAdd                       `json:"orderAdds" gorm:"foreignKey:OrderId"`
	Status       string                           `json:"status" form:"status" gorm:"column:status;size:64;comment:账单状态"`
	IsPayOff     bool                             `json:"isPayOff" gorm:"column:is_pay_off;comment:是否结清;default:false"`
}

func (Order) TableName() string {
	return "order"
}

func (Order) TableComment() string {
	return "签约表"
}
